# Contributor: Matthias Ahouansou <matthias@ahouansou.cz>
# Maintainer: Matthias Ahouansou <matthias@ahouansou.cz>
pkgname=tree-sitter-xml
pkgver=0_git20231108
_gitrev=a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697
pkgrel=0
pkgdesc="XML & DTD grammars for tree-sitter"
url="https://github.com/ObserverOfTime/tree-sitter-xml"
arch="all"
license="MIT"
makedepends="tree-sitter-dev"
subpackages="$pkgname-doc"
provides="tree-sitter-dtd=$pkgver-r$pkgrel"
install_if="tree-sitter-grammars"
source="$pkgname-$_gitrev.tar.gz::https://github.com/ObserverOfTime/tree-sitter-xml/archive/$_gitrev.tar.gz"
builddir="$srcdir/$pkgname-$_gitrev"
options="!check"  # no tests for shared lib

_langs='xml dtd'

build() {
	local lang; for lang in $_langs; do
		abuild-tree-sitter build -s "tree-sitter-$lang/src"
	done
}

package() {
	local lang; for lang in $_langs; do
		DESTDIR="$pkgdir" abuild-tree-sitter install -s "tree-sitter-$lang/src" -q "tree-sitter-$lang/queries"
	done
	install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
88e700df595349dc000d816e9dbc3c19e83bd1dabff605f5e2987b55e41eb836f21fd419a912f9f85c7b239ac453c5820dc4a1d16a78a8a92d3e8966a1edb1e0  tree-sitter-xml-a3bfa1ae7e8400ab81a6358f5e8d2983f5dd0697.tar.gz
"
